<template>
    <div id="pdfDom1">
      <!-- 孕期营养处方 -->
      <div style="">
        <div style=" width: 100%; background-color:#2ab28b;  text-align: center; margin:auto">
          <div style="font-size: 40px; font-weight: bold; color: #ffffff;padding-top:20px;">{{ Titlename }}</div>
          <!-- <span style="font-size: 30px; color: #666666; margin-left: 20px;display: block;">基本信息报告</span> -->
          <div style="margin-top:30px;font-size: 24px;padding-bottom: 20px;font-weight: bold;color:#333333;">儿童营养风险筛查报告单
          </div>
        </div>
      </div>
      <div style="width: 100%; height: 40px; background-color: #2AB28B; margin-top: 10px; display: flex;">
            <div><img src="../assets/img/12.jpg" style="height: 40px" alt="" /></div>
            <div style="font-size: 20px; margin-left: 10px; line-height: 40px; color: #fff;">儿童基本信息</div>
          </div>
          <div
        style="width: 1070px; border-top: 2px solid #09a578; border-right: 2px solid #09a578;  margin-top: 10px;font-size: 14px;"
        v-if="times == 2">
        <div style="display: flex">
          <div
            style="background-color: rgb(42, 178, 139); width: 10%;height: 40px;text-align: center;line-height: 40px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            儿童姓名
          </div>
          <div
            style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            {{ contents.username ?? '[]' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%; height: 40px; text-align: center; line-height: 40px; color:#fff; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
            性别
          </div>
          <div
            style="width: 15%; height: 40px; text-align: center;line-height: 40px;border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
            {{ contents.sex == 1 ? '女' : '男' ?? '[]' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139); width: 10%; height: 40px; text-align: center; line-height: 40px; color:#fff; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
            出生日期
          </div>
          <div
            style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            {{ birth ?? '[]' }}
          </div>
          <div
            style=" background-color: rgb(42, 178, 139); width: 10%; height: 40px; text-align: center; line-height: 40px;color:#fff; border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            年龄
          </div>
          <div style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-bottom: 2px solid #09a578;">
            {{ births }}
          </div>
        </div>
        <div style="display: flex">
          <div
            style="background-color: rgb(42, 178, 139); width: 10%;height: 40px;text-align: center;line-height: 40px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            身高
          </div>
          <div
            style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            {{ contents.height ? contents.height + 'CM' : '' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%; height: 40px; text-align: center; line-height: 40px; color:#fff; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
            体重
          </div>
          <div
            style="width: 15%; height: 40px; text-align: center;line-height: 40px;border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
            {{ contents.weight ? contents.weight + 'KG' : '' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139); width: 10%; height: 40px; text-align: center; line-height: 40px; color:#fff; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
            监护人姓名
          </div>
          <div
            style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            {{ contents.guardian_name ?? '[]' }}
          </div>
          <div
            style=" background-color: rgb(42, 178, 139); width: 10%; height: 40px; text-align: center; line-height: 40px;color:#fff; border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            监护人手机号
          </div>
          <div style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-bottom: 2px solid #09a578;">
            {{ contents.guardian_mobile ?? '[]' }}
          </div>
        </div>
        <div style="display: flex">
          <div
            style="background-color: #2AB28B; width: 9.9%;height: 40px;text-align: center;line-height: 40px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            检测日期</div>
          <div style="width: 40%; height: 40px; border-bottom: 2px solid #09a578; line-height: 40px; text-indent: 20px;border-right: 2px solid #09a578;">
            {{ report_time }}
          </div>
          <div
            style="background-color: #2AB28B; width: 9.9%;height: 40px;text-align: center;line-height: 40px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            BMI</div>
          <div style="width: 40%; height: 40px; border-bottom: 2px solid #09a578; line-height: 40px; text-indent: 20px;">
            {{ BMIs }}
          </div>
        </div>
      </div>
      <div style="width: 1070px; border-top: 2px solid #09a578; border-right: 2px solid #09a578;  margin-top: 10px"
        v-if="times == 1">
        <div style="display: flex">
          <div
            style="background-color: #2AB28B; width: 9.9%;height: 40px;text-align: center;line-height: 40px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            检测日期</div>
          <div style="width: 90%; height: 40px; border-bottom: 2px solid #09a578; line-height: 40px; text-indent: 20px;">
            {{ report_time }}
          </div>
        </div>
        <div style="display: flex">
          <div
            style="background-color: rgb(42, 178, 139); width: 10%;height: 40px;text-align: center;line-height: 40px;color: #fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            儿童姓名
          </div>
          <div
            style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            {{ contents.username ?? '[]' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%; height: 40px; text-align: center; line-height: 40px; color:#fff; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
            性别
          </div>
          <div
            style="width: 15%; height: 40px; text-align: center;line-height: 40px;border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
            {{ contents.sex == 1 ? '女' : '男' ?? '[]' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139); width: 10%; height: 40px; text-align: center; line-height: 40px; color:#fff; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578;">
            出生日期
          </div>
          <div
            style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            {{ birth ?? '[]' }}
          </div>
          <div
            style=" background-color: rgb(42, 178, 139); width: 10%; height: 40px; text-align: center; line-height: 40px;color:#fff; border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            监护人姓名
          </div>
          <div style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-bottom: 2px solid #09a578;">
            {{ contents.guardian_name ?? '[]' }}
          </div>
        </div>
        <div style="display: flex">
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            监护人手机号
          </div>
          <div
            style=" width: 15%; height: 40px; text-align: center; line-height: 40px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
            {{ contents.guardian_mobile ?? '[]' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            身高
          </div>
          <div
            style=" width: 15%; height: 40px; text-align: center; line-height: 40px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
            {{ contents.height ? contents.height + 'CM' : '' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            体重
          </div>
          <div
            style=" width: 15%; height: 40px; text-align: center; line-height: 40px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
            {{ contents.weight ? contents.weight + 'KG' : '' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            头围
          </div>
          <div style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-bottom: 2px solid #09a578;">
            {{ contents.touwei ? contents.touwei + 'CM' : '' }}
          </div>
        </div>
        <div style="display: flex">
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            出生身长
          </div>
          <div
            style=" width: 15%; height: 40px; text-align: center; line-height: 40px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
            {{ contents.chushengsg ? contents.chushengsg + 'CM' : '' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            出生体重
          </div>
          <div
            style=" width: 15%; height: 40px; text-align: center; line-height: 40px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
            {{ contents.chushengtz ? contents.chushengtz + 'KG' : '' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            腹围
          </div>
          <div
            style=" width: 15%; height: 40px; text-align: center; line-height: 40px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
            {{ contents.fuwei ? contents.fuwei + 'CM' : '' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            血型
          </div>
          <div style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-bottom: 2px solid #09a578;">
            {{ contents.xuexing_value ? contents.xuexing_value : '' }}
          </div>
        </div>
        <div style="display: flex">
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            民族
          </div>
          <div
            style=" width: 15%; height: 40px; text-align: center; line-height: 40px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
            {{ contents.minzu_value ? contents.minzu_value : '' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            与监护人关系
          </div>
          <div
            style=" width: 15%; height: 40px; text-align: center; line-height: 40px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
            {{ contents.guanxi_value ? contents.guanxi_value : '' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            家长受教育程度
          </div>
          <div
            style=" width: 15%; height: 40px; text-align: center; line-height: 40px; border-right: 2px solid #09a578; border-bottom: 2px solid #09a578; ">
            {{ contents.jiaoyu_value ? contents.jiaoyu_value : '' }}
          </div>
          <div
            style="background-color: rgb(42, 178, 139);width: 10%;height: 40px;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;">
            出生情况
          </div>
          <div style="width: 15%;height: 40px;text-align: center;line-height: 40px;border-bottom: 2px solid #09a578;">
            {{ contents.birthSituation_value ? contents.birthSituation_value : '' }}
          </div>
        </div>
      </div>

        <div style=" width: 100%; background-color:#2ab28b;  text-align: center; margin:auto;">
          <div
            style="margin-top:30px;font-size: 24px;padding-bottom: 20px;font-weight: bold;padding-top: 20px;color:#333333;">
            儿童疾病分析中医理疗食疗推荐</div>
        </div>
        <div v-for="(item, index) in Diseaseanalysis" :key="index">
          <div :style="index==0?'width: 100%;height: 40px;background-color: rgb(42, 178, 139);margin-top: 20px;display: flex;':'width: 100%;height: 40px;background-color: rgb(42, 178, 139);margin-top: 20px;display: flex;page-break-before: always;'">
            <div><img src="../assets/img/23.jpg" style="height: 40px" alt="" /></div>
            <div style="font-size: 20px;margin-left: 10px;line-height: 40px;color:#fff;"> {{ item.food_label_name }}</div>

          </div>
          <div style="width: 99.5%;border:2px solid #2ab28b;margin-top:10px;">
            <div style="display: flex">
              <div
                style="background-color: rgb(42, 178, 139);width: 14%;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;display:flex;align-items: center;justify-content:center;">
                疾病原因
              </div>
              <div
                style="width: 90%;border-bottom: 2px solid #09a578;line-height: 40px;padding:0px 20px;overflow: hidden;height:42px;text-overflow: ellipsis;-o-text-overflow: ellipsis;white-space: nowrap;">
                {{ item.title }}
              </div>
            </div>
            <div style="display: flex">
              <div
                style="background-color: rgb(42, 178, 139);width: 14%;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;display:flex;align-items: center;justify-content:center;">
                疾病简介
              </div>
              <div style="width: 90%;border-bottom: 2px solid #09a578;;padding:10px 20px;align-items:center;">
                {{ item.introduce }}
              </div>
            </div>
            <div style="display: flex">
              <div
                style="background-color: rgb(42, 178, 139);width: 14%;text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;display:flex;align-items: center;justify-content:center;">
                穴位按摩
              </div>
              <div style="width: 90%;border-bottom: 2px solid #09a578;;padding:0px 20px;display:flex;">
                <div>
                  <img style="width:200px;height:300px;margin:10px auto;"
                    :src="'http://' + baseUrl + '/' + item.acupointavatar">
                </div>
                <div style="margin-left:20px;margin-top:20px;">
                  <div style="font-size:20px;font-weight:bold;">
                    {{ Object.keys(item.acupoint_introducegroup)[0] }}
                  </div>
                  <div style="font-size:16px;margin-top:20px;">
                    {{ Object.values(item.acupoint_introducegroup)[0] }}
                  </div>
                </div>
              </div>
            </div>
            <div style="display: flex">
              <div
                style="background-color: rgb(42, 178, 139);text-align: center; line-height: 40px;color:#fff;border-right: 2px solid #09a578;border-bottom: 2px solid #09a578;display:flex;align-items: center;justify-content:center;white-space:nowrap;padding:0px 10px">
                {{ Object.keys(item.disease_causesgroup)[0] }}
              </div>
              <div style="width: 90%;border-bottom: 2px solid #09a578;;padding:10px 20px;align-items:center;display:flex;">
                {{ Object.values(item.disease_causesgroup)[0] }}
              </div>
            </div>
            <div style="margin-bottom:20px;">
              <div style=" width: 100%;height: 40px;background-color: rgb(42, 178, 139);display: flex;">
                <div style="font-size: 20px;margin-left: 10px;line-height: 40px;color:#fff;"> 对症食谱</div>
              </div>
              <div style="width:98%;display:flex;justify-content: left;flex-wrap: wrap;">
                <div style="width:30%;margin-right:3%;margin-top:10px;text-align: center;"
                  v-for="(items, indexes) in item.foodIntervention" :key="items.id">
                  <!-- page-break-before: always; -->
                  <div v-if="indexes<3"> 
                    <div style="width:100%;font-size:16px;font-weight:bold;">{{ items.food_name }}</div>
                    <div style='padding-top:10px;'>
                      <img style="width:100px;height:100px;" :src="'http://' + baseUrl + '/' + items.meal_image">
                    </div>
                    <div style="margin-top:10px;width:90%;text-align:left;margin:auto;padding-top: 10px;"><span style="color:#09a578;margin-top:5px;">原料:</span>{{ items.ingredient }}</div>
                    <div style="margin-top:10px;width:90%;text-align:left;margin:auto;padding-top: 10px;"><span style="color:#09a578;margin-top:5px;">做法:</span>{{ items.practice }}</div>
                    <div style="margin-top:10px;width:90%;text-align:left;margin:auto;padding-top: 10px;"><span style="color:#09a578;margin-top:5px;">营养功效:</span>{{ items.nutrition }}</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
          <div style="width: 30%;height: 40px;border: 2px solid #09a578;margin-top: 20px;margin-bottom: 20px;display: flex;">
            <div
              style=" width: 42%;line-height: 40px;background-color: rgb(42, 178, 139);color:#fff;height: 100%;text-align: center;border-right: 2px solid #09a578;">
              主治医师
            </div>
            <div style="width: 58%;height: 100%;line-height: 40px;text-align: center;">{{Doctor}}</div>
          </div>
          <div style="width: 30%;height: 40px;border: 2px solid #09a578;margin-top: 20px;margin-bottom: 20px;display: flex;">
            <div
              style=" width: 42%;line-height: 40px;background-color: rgb(42, 178, 139);color:#fff;height: 100%;text-align: center;border-right: 2px solid #09a578;">
              检测护士
            </div>
            <div style="width: 58%;height: 100%;line-height: 40px;text-align: center;">{{Doctor1}}</div>
          </div>
          <div style="width: 30%;height: 40px;border: 2px solid #09a578;margin-top: 20px;margin-bottom: 20px;display: flex;">
            <div
              style=" width: 42%;line-height: 40px;background-color: rgb(42, 178, 139);color:#fff;height: 100%;text-align: center;border-right: 2px solid #09a578;">
              报告日期
            </div>
            <div style="width: 58%;height: 100%;line-height: 40px;text-align: center;">{{report_time}}</div>
          </div>
      <div v-if="code_1=='true'" style="margin-top: 20px;height:150px;text-align: end;margin-right: 50px;margin-bottom:10px;">
          <img style="width: 100px;height:100px;" :src="'http://' + baseUrl + '/' +codeimg" alt="">
          <div style="margin-top:10px;font-size: 20px;font-weight: bold;">
            扫码关注公众号,获取在线报告
          </div>
      </div>
    </div>
  </template>
    
  <script setup>
  import { Edit, CirclePlus, Search, Expand, } from '@element-plus/icons-vue'
  import { defineComponent, onMounted, ref, watch, reactive } from 'vue'
  import Header from './common/Header.vue';
  import ChildLeft from './common/ChildLeft.vue';
  import { useRoute, useRouter } from "vue-router"
  import http, { baseUrl } from "../utils/http";
  import Drawer from './common/Drawer.vue';
  import { ElMessage, ElMessageBox } from "element-plus";
  import * as api from "../api/loginHttp";
  const route = useRoute()
  const code_1 = ref(false)
  const router = useRouter()
  const labName = ref()
  const options = ref([{
    value: '早餐',
    label: '早餐',
  },
  {
    value: '中餐',
    label: '中餐',
  },
  {
    value: '晚餐',
    label: '晚餐',
  },])
  const checkList = ref([])
  const tan = ref(true)
  const loadings = ref(true)
  const list = ref({})
  const codeimg=ref()
  const energy = ref(0)
  const energys = ref()
  const OilEnergy = ref(0)
  const drawer = ref(false)
  const Diseaseanalysis=ref()
  const radio1 = ref('')
  const radio2 = ref('')
  const times=ref()
  const radio3 = ref('')
  const radio4 = ref('')
  const total = ref(0)
  const userinfo = ref({})
  const Prints = ref('true')
  const Titlename = ref()
  const contents = ref({})
  const reportId = ref();
  const username = ref();
  const guardian = ref();
  const birth = ref();
  const birthStatus = ref();
  const report_time = ref();
  const foodIntervention=ref();
  const births=ref();
  const BMIs=ref();
  const groupId = ref()
  const id = ref()
  const popWrite = ref(false)
  const Doctor=ref()
  const Doctor1=ref()
  const popWriteDirection = ref('ttb')
  const pageList = async () => {
    await router.push({ 'path': '/pageList/' + groupId.value })
  }
  const size = ref('150%')
  
  const formInline = ref({
    Fat: '',
    FatMin: '',
    FatMax: '',
    Bone: '',
    BoneMin: '',
    BoneMax: '',
    Protein: '',
    ProteinMin: '',
    ProteinMax: '',
    Water: '',
    WaterMin: '',
    WaterMax: '',
    LBM: '',
    ICW: '',
    Weight: '',
    WeightMin: '',
    WeightMax: '',
    Muscle: '',
    MuscleMin: '',
    MuscleMax: '',
    PBF: '',
    PBFMin: '',
    PBFMax: '',
    SMM: '',
    SMMMin: '',
    SMMMax: '',
    BMI: '',
    BMIMin: '',
    BMIMax: '',
    WHR: '',
    WHRMin: '',
    WHRMax: '',
    Weight_control: '',
    Fat_control: '',
    Muscle_control: '',
    VFI: '',
    VFIMin: '',
    VFIMax: '',
    Edema: '',
    EdemaMin: '',
    EdemaMax: '',
    ECW: '',
    BMR: '',
    name: '',
  })
  
  const onHome = async () => {
    await router.push({ 'path': '/Home' })
  }
  const radi1 = () => {
    total.value = parseInt(radio1.value) + parseInt(radio2.value) + parseInt(radio3.value) + parseInt(radio4.value);
  }
  const radi2 = () => {
    total.value = parseInt(radio1.value) + parseInt(radio2.value) + parseInt(radio3.value) + parseInt(radio4.value);
  }
  const radi3 = () => {
    total.value = parseInt(radio1.value) + parseInt(radio2.value) + parseInt(radio3.value) + parseInt(radio4.value);
  }
  const radi4 = () => {
    total.value = parseInt(radio1.value) + parseInt(radio2.value) + parseInt(radio3.value) + parseInt(radio4.value);
  }
  const onChange = async (index, value) => {
    list._rawValue[index].energy = (list._rawValue[index].single.energy * value).toFixed(2)
    list._rawValue[index].weight = (list._rawValue[index].single.weight * value).toFixed(2)
    list._rawValue[index].protein = (list._rawValue[index].single.protein * value).toFixed(2)
    list._rawValue[index].fat = (list._rawValue[index].single.fat * value).toFixed(2)
    list._rawValue[index].carbohydrate = (list._rawValue[index].single.carbohydrate * value).toFixed(2)
    list._rawValue[index].calcium = (list._rawValue[index].single.calcium * value).toFixed(2)
    list._rawValue[index].sodium = (list._rawValue[index].single.sodium * value).toFixed(2)
    list._rawValue[index].magnesium = (list._rawValue[index].single.magnesium * value).toFixed(2)
    list._rawValue[index].iron = (list._rawValue[index].single.iron * value).toFixed(2)
    list._rawValue[index].zinc = (list._rawValue[index].single.zinc * value).toFixed(2)
    list._rawValue[index].selenium = (list._rawValue[index].single.selenium * value).toFixed(2)
    list._rawValue[index].vitamin_a = (list._rawValue[index].single.vitamin_a * value).toFixed(2)
    list._rawValue[index].vitamin_e = (list._rawValue[index].single.vitamin_e * value).toFixed(2)
    list._rawValue[index].vitamin_b1 = (list._rawValue[index].single.vitamin_b1 * value).toFixed(2)
    list._rawValue[index].vitamin_b2 = (list._rawValue[index].single.vitamin_b2 * value).toFixed(2)
    list._rawValue[index].vitamin_c = (list._rawValue[index].single.vitamin_c * value).toFixed(2)
  
    energys.value = 0
    for (let i = 0; i < list._rawValue.length; i++) {
      energys.value += (list._rawValue[i].energy) * 1;
      console.log(list._rawValue[i].energy)
  
    }
  
  }
  
  const btn_fenxi = async () => {
    let params = {
      'id': reportId.value,
      'user_id': id.value,
      'diet_energy': energy._value,
      'diet': list._rawValue,
    }
  
    const data = await api.diet(params);
  
    if (data.data.code == 0) {
      ElMessage.error(data.data.msg)
      return false;
    } else {
      const { href } = await router.resolve({
        path: "/Dietary/" + groupId.value + "/" + id.value + '/' + reportId.value
      });
      window.open(href, "_blank");
    }
  
  }
  
  const cancelClick = async () => {
    popWrite.value = false;
  }
  
  const confirmClick = async () => {
    Object.keys(formInline._rawValue).forEach(function (item, index) {
      //item 就是当日按循环到的对象
      //index是循环的索引，从0开始
      if (formInline._rawValue[item] == '') {
        ElMessage.error('必填项不能为空')
        return;
      }
      // console.log(formInline._rawValue[item]);
    })
  
  
  
    // for(let i = 0; i < Object.keys(formInline._rawValue).length; i++) {
    //   console.log(i);
    //   console.log(formInline._rawValue[i]);
    //   if (formInline.value[i] == '') {
    //     ElMessage.error('必填项不能为空')
    //     return false;
    //   }
    // }
  }
  
  const get_new = async () => {
    const res = await api.getFood();
  }
  
  // const handClick = async ()  => {
  //   console.log('手动输入体成分数据');
  // }
  
  const handClick = async () => {
    popWrite.value = true;
  }
  
  
  
  const appraisal = async () => {
    http.get('api/archives/analysis?id=' + id.value + '&type=analysis').then((res) => {
      if (res.data.code === 0) {
        ElMessage.error(res.data.msg)
      }
    })
  }
  
  const guanbi = async () => {
    tan.value = false;
    http.get('api/archives/analysis?id=' + id.value + '&type=cancel').then((res) => {
      if (res.data.code === 0) {
        ElMessage.error(res.data.msg)
      }
    })
  }
  
  const goto = async () => {
    const { href } = await router.resolve({
      path: "/analysis/" + groupId.value + "/" + id.value + "/" + reportId.value
    });
    window.open(href, "_blank");
  }
  
  
  const btn = async () => {
    // // 只要点击文档，那么就将数据保存起来
    http.get('api/archives/setReportStatus?reportId=' + reportId.value).then((res) => {
      if (res.data.code === 0) {
        ElMessage.error(res.data.msg)
        return false
      }
    })
    const { href } = await router.resolve({
      path: "/reportView/" + groupId.value + "/" + id.value + "/" + reportId.value
    });
    window.open(href, "_blank");
  }
  
  const fetchData = async () => {
    //获取医院名称
    Titlename.value = localStorage.getItem('Title');
    if (parseInt(radio1.value)) {
      total.value = parseInt(radio1.value) + parseInt(radio2.value) + parseInt(radio3.value) + parseInt(radio4.value);
    } else {
      total.value = 0;
    }
    //获取个人信息
    if (route.params.groupId) {
      groupId.value = route.params.groupId;
      id.value = route.params.id;
      reportId.value = route.params.reportId;
      username.value = route.params.username;
      guardian.value = route.params.guardian;
      birthStatus.value = route.params.birth;
      codeimg.value=window.localStorage.getItem('ercode')
  
  //获取用户年龄
 http.get("api/archives/evaluating?id=" + id.value ).then((res) => {
      births.value=res.data.data.birth;
  });
      //获取二维码是否显示
    http.get('api/index/getAuth').then((res)=>{
        let aray=res.data.data;
        let array=aray.split(',');
        if(array.includes('12')){
          code_1.value='true'
        }else{
          code_1.value='false'
        }
      })
  
      http.get("api/archives/viewReportMember?id=" + reportId.value + "&username=" + '' + "&guardian=" + '' + "&birth=" + '').then((res) => {
        if (res.data.data.times) {
          let parsedDate = new Date(res.data.data.times);
          let targetDateObj = new Date('2024-01-08');
          if (parsedDate < targetDateObj) {
            times.value = 1;
          } else if (parsedDate > targetDateObj) {
            times.value = 2;
          }
        }
        
        if (res.data.code === 0) {
          ElMessage.error(res.data.msg);
        }
        Doctor.value=res.data.data.contents.doctor;
        Doctor1.value=res.data.data.contents.doctor1;
        BMIs.value=res.data.data.bmi;
        report_time.value = res.data.data.times;
        contents.value = res.data.data.contents;
        birth.value = res.data.data.contents.birth;
      });
    }

    http.get('api/archives/viewreport?id=' + reportId.value + '&username=' + '' + '&guardian=' + '' + '&birth=' +'').then((res) => {
      Diseaseanalysis.value = res.data.data.FoodDiseaseintervention;
    })
  
  
    if (route.params.groupId) {
      groupId.value = route.params.groupId
      id.value = route.params.id
      reportId.value = route.params.reportId
      if (groupId.value == 3) {
        labName.value = '婴幼儿营养测评'
      } else if (groupId.value == 5) {
        labName.value = '孕产妇营养测评'
      } else if (groupId.value == 6) {
        labName.value = '成年人营养测评'
      } else if (groupId.value == 7) {
        labName.value = '慢性病营养测评'
      } else if (groupId.value == 8) {
        labName.value = '团体营养测评'
      }
      //获取个人信息
      http.get('api/archives/evaluating?id=' + id.value).then((res) => {
        userinfo.value = res.data.data;
      })
      //获取营养风险筛查表格数据
      http.get('api/archives/screeningInfo?id=' + route.params.id).then((res) => {
        
        radio1.value = res.data.data.screening[0].toString();
        radio2.value = res.data.data.screening[1].toString();
        radio3.value = res.data.data.screening[2].toString();
        radio4.value = res.data.data.screening[3].toString();
        total.value = res.data.data.screening[4].toString();
       
      })
      setTimeout(() => {
          print("#pdfDom1");
        }, 2000);
    } else {
      ElMessage.error('栏目编号不得为空')
      await router.push({ 'path': '/Home' })
    }
  
  }
  
  onMounted(() => {
    fetchData()
  })
  </script>
    
  <style scoped>
  @import '../assets/css/common.css';
  @media print {
    .risk_1 {
      margin-right: 30px;
    }
  
    .risk_3 {
      margin-bottom: 20px;
    }
  }
  
  @media screen and (max-width:1920px) {
    .risk_1 {
      margin-left: 30px;
    }
  
    .risk_3 {
      margin-bottom: 20px;
    }
  
    .risk_2 {
      margin-left: 10px;
    }
  
    .right-box-card .all button {
      width: 85px;
      margin-right: 14px;
    }
  
    .el-drawer__body .drVal {
      padding-top: 50px;
    }
  }
  
  
  .BMIprimary {
    width: 268px;
    height: 70px;
    background: #2AB28B;
    opacity: 1;
    border-radius: 8px;
    font-size: 24px;
  }
  
  .BMIDefault {
    width: 268px;
    height: 70px;
    background: #fff;
    opacity: 1;
    color: #2AB28B;
    border-radius: 8px;
    font-size: 24px;
    border: 1px solid #2ab28b;
  }
  
  .el-drawer__body {
    overflow: auto;
  }
  
  .el-drawer__container ::-webkit-scrollbar {
    display: none;
  }
  
  ::v-deep .el-button:focus,
  .el-button:hover {
    background: #2AB28B;
    color: #fff;
  }
  
  ::v-deep .el-progress-bar__inner {
    background: #2AB28B;
  }
  </style>
  <style>
  .right-box-card {
    margin-left: 2%;
    margin-top: 1%;
    position: static;
    top: calc(260px);
    width: 60%;
    float: left;
  
  }
  
  .right-box-card .all span {
    margin-right: 5px;
    font-size: 14px;
  }
  
  .right-box-card .all .num1 {
    width: 100px;
    border: none;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #3ea4aa;
  }
  
  .num {
    width: 62px;
    border: none;
    text-align: center;
    background: #fff;
  }
  
  .right-box-card .all button {
    display: inline-block;
    width: 96px;
    height: 40px;
    text-align: center;
    line-height: 40px;
    background: #3ea4aa;
    border-radius: 3px;
    color: #ffffff;
    font-size: 16px;
    float: right;
    margin-right: 40px;
    margin-top: 70px;
    border: none;
  }</style>
    